
import {getToken} from '@/utils/auth'
import axios from 'axios'

const fileAxios = axios.create({
    // axios中请求配置有baseURL选项，表示请求URL公共部分
    baseURL: process.env.VUE_APP_FILE_API,
    // 超时
    timeout: 10000
})

export function uploadFuncAwait(str, formData) {
    // var url = process.env.VUE_APP_FILE_API + str
    return fileAxios({
      url: str,
      method: 'POST',
      data: formData,
      timeout: 0, //无超时
      headers: {
        'Authorization': 'Bearer ' + getToken(),
        'Content-Type': 'multipart/form-data'
      }
    })
  }
